﻿using System.Web.Http;
using System.Web.Http.OData.Query;
using NorthWind.Entity;
using Repository.Pattern.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Service.Pattern;
using System.Data;

namespace NorthWind.Service
{
    public interface ICustomerService : IService<Customers>
    {

        IEnumerable<Customers> GetAll();
    }

    public class CustomerService : Service<Customers>, ICustomerService
    {
        private readonly IRepositoryAsync<Customers> _customerRepository;

        public CustomerService(IRepositoryAsync<Customers> customerRepository): base(customerRepository)
        {
            _customerRepository = customerRepository;
        }

        public IEnumerable<Customers> GetAll()
        {
            return _customerRepository.Queryable().AsEnumerable();
        }

    }
}
